import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ErroPan {

      public ErroPan(){
          String line = "未知错误！";
          //设置对话框将在3秒后自动关闭
          JOptionPane pane = new JOptionPane(line, JOptionPane.INFORMATION_MESSAGE);
          int TIME_VISIBLE = 5000;//单位ms
          Font f = new Font("隶书",Font.PLAIN,20);
          JDialog dialog = pane.createDialog(null, "5秒后自动关闭");
          dialog.setFont(f);
          dialog.setModal(false);
          dialog.setVisible(true);


          new Timer(TIME_VISIBLE, new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  dialog.dispose();
              }
          }).start();
      }


}
